import java.lang.reflect.Array;
import java.util.Arrays;

public class demo10 {
    public static void main(String[] args) {
        int a[] = {2,9,5,0,1,3,6,8};
        int b = 0;
        int end = a.length-1;
        while (b<end){
            int min = a[b];
            int t = b;
            for (int i = b; i<=end ; i++) {
                if(min>a[i]){
                    min = a[i];
                    t = i;

                }
            }
            a[t] = a[b];
            a[b] = min;
            b++;
        }
        System.out.println(Arrays.toString(a));
    }
}
